package wekan.client;
import android.app.Application;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.util.Log;

public class WModel extends Application {

    public static final String TAG = "WEKA - ";

    private WNetwork network;
    private Location currentLocation;
    private LocationManager mlocManager;
    private LocationListener mlocListener;


    public WModel() {
        super() ;
        Log.d(TAG, "MODEL STARTING ...") ;


    }


    public void startGPS(LocationManager mloc){
        mlocManager = mloc;
        mlocListener = new WLocationListener(this);
        mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener);
        currentLocation=mlocManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
    }

    public void startNetwork(){
        network = new WNetwork();
        network.start();
    }

    public WNetwork getNetwork(){
        return network;
    }

    public void setCurrentLocation(Location l){
        currentLocation = l;
    }

    public Location getCurrentLocation(){
        return currentLocation;
    }
}
